from random import randint
from faker import Faker
from .models import db, Questionnaire

fake = Faker()

def fakes(count: int=10):
    for i in range(count):
        q1 = str(randint(1, 7))
        if randint(1, 5) == 1:
            q2 = '2'
            q3 = '1'
            q4 = '1'
            q5 = '1'
            q6 = '1'
            q7 = '1'
            q8 = '1'
        else:
            q2 = '1'
            q3 = str(randint(2, 7))
            q4 = str(randint(1, 3))
            q5 = '4'
            q6 = '2'
            q7 = str(randint(2, 4))
            q8 = str(randint(1, 6))
        quesitonnaire = Questionnaire(
            q1=q1, q2=q2, q3=q3, q4=q4,
            q5=q5, q6=q6, q7=q7, q8=q8
        )
        db.session.add(quesitonnaire)
    db.session.commit()
